<?
    class categoryFilterOrder extends CWidget {

		public $order;
		public $count;
		public $id;
		public $perpage;
		public $manufacturer;
		public $feature;
		public $beforeText = 'Сортировать по: ';

        public function run() {
			if($this->order == '2'){
				$ordertitle = '1';
				$titlearrow = '&uarr;';
			}elseif($this->order == '1'){
				$ordertitle = '2';
				$titlearrow = '&darr;';
			}else{
				$ordertitle = '2';
				$titlearrow = '';
			}
			if($this->order == '4'){
				$orderprice = '3';
				$pricearrow = '&uarr;';
			}elseif($this->order == '3'){
				$orderprice = '4';
				$pricearrow = '&darr;';
			}else{
				$orderprice = '4';
				$pricearrow = '';
			}
			
			echo $this->beforeText;

			echo "&nbsp;";
			echo CHtml::link('Наименование'.$titlearrow, Yii::app()->createUrl("category/index", array(
				'id' => $this->id,
				'perpage' => $this->perpage,
				'order' => $ordertitle,
				'manufacturer' => $this->manufacturer,
				'feature' => $this->feature
			)));
			echo "&nbsp;";
			echo CHtml::link('Цена'.$pricearrow, Yii::app()->createUrl("category/index", array(
				'id' => $this->id,
				'perpage' => $this->perpage,
				'order' => $orderprice,
				'manufacturer' => $this->manufacturer,
				'feature' => $this->feature
			)));

        }
    }
?>